﻿using System;
using System.Collections.Generic;
using System.Linq;
using Century.Model;
using Century.Common;
using Century.Model.CMS;
using Century.Business.CMS;

namespace Century.Web.UI.MVC
{
    public abstract class CenturyBaseController : BaseController
    {

        //private ISiteService siteService { get; set; }

        public CenturyBaseController(ISiteService siteService) : base(siteService) { }

        protected Site GetSiteIdByPath(string stPath)
        {
            return siteService.GetSiteByPath(stPath);
        }

        protected SitePage GetPage(string pageName, string sitePath)
        {
            Site site = GetSiteIdByPath(sitePath);
            if (site == null)
            {
                return null;
            }
            FrameworkToken.UserToken.CurrentSite = site;
            return siteService.GetPage(pageName, site.Id);
        }
        //protected CacheableList<CountrySite> AvailableSites
        //{
        //    get
        //    {
        //        return PersistData.AvailableSites;
        //    }
        //}

        //protected SitePage CurrentPage
        //{
        //    get
        //    {
        //        return PersistData.CurrentPage;
        //    }
        //}

        //protected CacheableList<SitePage> AvailablePages
        //{
        //    get
        //    {
        //        return PersistData.AvailablePages;
        //    }
        //}

        //protected List<CharValueDTO> GetCharValues(CharacteristicType characteristicType)
        //{
        //    return CharacteristicService.GetCharValues(characteristicType);
        //}

        /// <summary>
        /// 
        /// </summary>
        /// <param name="messageKey"></param>
        protected void ShowMessage(string messageKey)
        {
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="errorKey"></param>
        protected void ShowError(string errorKey)
        {
            ShowError(errorKey, null);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="errorKey"></param>
        /// <param name="exc"></param>
        protected void ShowError(string errorKey, Exception exc)
        {
        }




    }
}
